/*
 * $Id: WinSys.java 3 2007-12-07 01:24:30Z rasan.rasch $
 *
 * Copyright (c) 2002-2006 UC Regents
 * 
 * Permission to use, copy, modify, distribute, and sell this software and
 * its documentation for any purpose is hereby granted without fee, provided
 * that (i) the above copyright notices and this permission notice appear in
 * all copies of the software and related documentation, and (ii) the names
 * of the UC Regents and the University of California are not used in any
 * advertising or publicity relating to the software without the specific,
 * prior written permission of the University of California.
 * 
 * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
 * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
 * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
 * 
 * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE FOR ANY
 * SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
 * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
 * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY
 * THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE
 * OR PERFORMANCE OF THIS SOFTWARE.
 */

package org.cdl.noid;

import jargs.gnu.CmdLineParser;
import java.io.IOException;

/** 
 * WinSys is a class for file system operations on Windows OS.
 * It is a concrete class of the Sys abstract class.
 * 
 * @author  Rasan Rasch (rasan@nyu.edu)
 * @version $Revision
 */
public class WinSys extends Sys {

	/** 
	 * Constructs a new WinSys object. 
	 */
	public WinSys() {
		super();
	}

	/** 
	 * Returns -1 (Operation not implemented on Windows).
	 */
	public int getUserID() {
		return -1;
	}

	/** 
	 * Returns -1 (Operation not implemented on Windows).
	 */
	public int getGroupID() {
		return -1;
	}

	/** 
	 * Return <code>CmdLineOptions</code> object representing the
	 * parsed command line options for <code>NoidTest<code>.
	 * 
	 * @param  args command line arguments
	 * @return      Options
	 * @see         Options
	 */
	public Options getOptions(String[] args) {
		CmdLineOptions opts = new CmdLineOptions(args);
		opts.parseOptions();
		return opts;
	}

	/** 
	 * Always Return true (Operation not implemented on Windows).
	 */
	public boolean chmod(String fileName) {
		return true;
	}
	
	/** 
	 * Return string representing user for current task.
	 * 
	 * @param  isWeb is current task in web context
	 * @return       user string
	 */
	public String getUser(boolean isWeb) {
		return System.getProperty("user.name");
	}

	/** 
	 * Print some system information.
	 */
	public void printSysinfo() {
		try {
			System.getProperties().store(System.out, "System Properties:");
		} catch (IOException e) {
			e.printStackTrace();
		}
	}	

}
